\hypertarget{class_q_c_p_layer}{}\section{Q\+C\+P\+Layer Class Reference}
\label{class_q_c_p_layer}\index{Q\+C\+P\+Layer@{Q\+C\+P\+Layer}}


A layer that may contain objects, to control the rendering order.  


Inheritance diagram for Q\+C\+P\+Layer\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{class_q_c_p_layer}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_q_c_p_layer_a5d0657fc86d624e5efbe930ef21af718}{Q\+C\+P\+Layer}} (\mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} $\ast$parent\+Plot, const Q\+String \&layer\+Name)
\item 
\mbox{\Hypertarget{class_q_c_p_layer_a5520019787482e13857ebe631c27c3fa}\label{class_q_c_p_layer_a5520019787482e13857ebe631c27c3fa}} 
\mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} $\ast$ {\bfseries parent\+Plot} () const
\item 
\mbox{\Hypertarget{class_q_c_p_layer_a37806f662b50b588fb1029a14fc5ef50}\label{class_q_c_p_layer_a37806f662b50b588fb1029a14fc5ef50}} 
Q\+String {\bfseries name} () const
\item 
int \mbox{\hyperlink{class_q_c_p_layer_ad322905c4700dcc7ceba63e011c730d2}{index}} () const
\item 
Q\+List$<$ \mbox{\hyperlink{class_q_c_p_layerable}{Q\+C\+P\+Layerable}} $\ast$ $>$ \mbox{\hyperlink{class_q_c_p_layer_a183b90941fc78f0b136edd77c5fb6966}{children}} () const
\item 
\mbox{\Hypertarget{class_q_c_p_layer_ad1cc2d6b32d2abb33c7f449b964e068c}\label{class_q_c_p_layer_ad1cc2d6b32d2abb33c7f449b964e068c}} 
bool {\bfseries visible} () const
\item 
void \mbox{\hyperlink{class_q_c_p_layer_ac07671f74edf6884b51a82afb2c19516}{set\+Visible}} (bool visible)
\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{class_q_c_p_layer_a57ce5e49364aa9122276d5df3b4a0ddc}\label{class_q_c_p_layer_a57ce5e49364aa9122276d5df3b4a0ddc}} 
void {\bfseries add\+Child} (\mbox{\hyperlink{class_q_c_p_layerable}{Q\+C\+P\+Layerable}} $\ast$layerable, bool prepend)
\item 
\mbox{\Hypertarget{class_q_c_p_layer_ac2f64ac7761650582d968d86670ef362}\label{class_q_c_p_layer_ac2f64ac7761650582d968d86670ef362}} 
void {\bfseries remove\+Child} (\mbox{\hyperlink{class_q_c_p_layerable}{Q\+C\+P\+Layerable}} $\ast$layerable)
\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{class_q_c_p_layer_a2f3374a7884bf403720cd1cf6f7ad1bb}\label{class_q_c_p_layer_a2f3374a7884bf403720cd1cf6f7ad1bb}} 
\mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} $\ast$ {\bfseries m\+Parent\+Plot}
\item 
\mbox{\Hypertarget{class_q_c_p_layer_a91e6298183cb4b9dfd4efdfaf1ecc220}\label{class_q_c_p_layer_a91e6298183cb4b9dfd4efdfaf1ecc220}} 
Q\+String {\bfseries m\+Name}
\item 
\mbox{\Hypertarget{class_q_c_p_layer_a122088bcab6cec76a52b75ce8606605b}\label{class_q_c_p_layer_a122088bcab6cec76a52b75ce8606605b}} 
int {\bfseries m\+Index}
\item 
\mbox{\Hypertarget{class_q_c_p_layer_a704aa71bba469383c3a3c598c1ec0d28}\label{class_q_c_p_layer_a704aa71bba469383c3a3c598c1ec0d28}} 
Q\+List$<$ \mbox{\hyperlink{class_q_c_p_layerable}{Q\+C\+P\+Layerable}} $\ast$ $>$ {\bfseries m\+Children}
\item 
\mbox{\Hypertarget{class_q_c_p_layer_a264950deb08e589460c126c895a1e2b5}\label{class_q_c_p_layer_a264950deb08e589460c126c895a1e2b5}} 
bool {\bfseries m\+Visible}
\end{DoxyCompactItemize}
\subsection*{Friends}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{class_q_c_p_layer_a1cdf9df76adcfae45261690aa0ca2198}\label{class_q_c_p_layer_a1cdf9df76adcfae45261690aa0ca2198}} 
class {\bfseries Q\+Custom\+Plot}
\item 
\mbox{\Hypertarget{class_q_c_p_layer_ad655f55cccf49ba14d5172ec517e07ae}\label{class_q_c_p_layer_ad655f55cccf49ba14d5172ec517e07ae}} 
class {\bfseries Q\+C\+P\+Layerable}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
A layer that may contain objects, to control the rendering order. 

The Layering system of \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} is the mechanism to control the rendering order of the elements inside the plot.

It is based on the two classes \mbox{\hyperlink{class_q_c_p_layer}{Q\+C\+P\+Layer}} and \mbox{\hyperlink{class_q_c_p_layerable}{Q\+C\+P\+Layerable}}. \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} holds an ordered list of one or more instances of \mbox{\hyperlink{class_q_c_p_layer}{Q\+C\+P\+Layer}} (see \mbox{\hyperlink{class_q_custom_plot_ad5255393df078448bb6ac83fa5db5f52}{Q\+Custom\+Plot\+::add\+Layer}}, \mbox{\hyperlink{class_q_custom_plot_a0a96244e7773b242ef23c32b7bdfb159}{Q\+Custom\+Plot\+::layer}}, \mbox{\hyperlink{class_q_custom_plot_ae896140beff19424e9e9e02d6e331104}{Q\+Custom\+Plot\+::move\+Layer}}, etc.). When replotting, \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} goes through the list of layers bottom to top and successively draws the layerables of the layers.

A \mbox{\hyperlink{class_q_c_p_layer}{Q\+C\+P\+Layer}} contains an ordered list of \mbox{\hyperlink{class_q_c_p_layerable}{Q\+C\+P\+Layerable}} instances. \mbox{\hyperlink{class_q_c_p_layerable}{Q\+C\+P\+Layerable}} is an abstract base class from which almost all visible objects derive, like axes, grids, graphs, items, etc.

Initially, \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} has five layers\+: \char`\"{}background\char`\"{}, \char`\"{}grid\char`\"{}, \char`\"{}main\char`\"{}, \char`\"{}axes\char`\"{} and \char`\"{}legend\char`\"{} (in that order). The top two layers \char`\"{}axes\char`\"{} and \char`\"{}legend\char`\"{} contain the default axes and legend, so they will be drawn on top. In the middle, there is the \char`\"{}main\char`\"{} layer. It is initially empty and set as the current layer (see \mbox{\hyperlink{class_q_custom_plot_a73a6dc47c653bb6f8f030abca5a11852}{Q\+Custom\+Plot\+::set\+Current\+Layer}}). This means, all new plottables, items etc. are created on this layer by default. Then comes the \char`\"{}grid\char`\"{} layer which contains the \mbox{\hyperlink{class_q_c_p_grid}{Q\+C\+P\+Grid}} instances (which belong tightly to \mbox{\hyperlink{class_q_c_p_axis}{Q\+C\+P\+Axis}}, see \mbox{\hyperlink{class_q_c_p_axis_a63f1dd2df663680d2a8d06c19592dd63}{Q\+C\+P\+Axis\+::grid}}). The Axis rect background shall be drawn behind everything else, thus the default \mbox{\hyperlink{class_q_c_p_axis_rect}{Q\+C\+P\+Axis\+Rect}} instance is placed on the \char`\"{}background\char`\"{} layer. Of course, the layer affiliation of the individual objects can be changed as required (\mbox{\hyperlink{class_q_c_p_layerable_ab0d0da6d2de45a118886d2c8e16d5a54}{Q\+C\+P\+Layerable\+::set\+Layer}}).

Controlling the ordering of objects is easy\+: Create a new layer in the position you want it to be, e.\+g. above \char`\"{}main\char`\"{}, with \mbox{\hyperlink{class_q_custom_plot_ad5255393df078448bb6ac83fa5db5f52}{Q\+Custom\+Plot\+::add\+Layer}}. Then set the current layer with \mbox{\hyperlink{class_q_custom_plot_a73a6dc47c653bb6f8f030abca5a11852}{Q\+Custom\+Plot\+::set\+Current\+Layer}} to that new layer and finally create the objects normally. They will be placed on the new layer automatically, due to the current layer setting. Alternatively you could have also ignored the current layer setting and just moved the objects with \mbox{\hyperlink{class_q_c_p_layerable_ab0d0da6d2de45a118886d2c8e16d5a54}{Q\+C\+P\+Layerable\+::set\+Layer}} to the desired layer after creating them.

It is also possible to move whole layers. For example, If you want the grid to be shown in front of all plottables/items on the \char`\"{}main\char`\"{} layer, just move it above \char`\"{}main\char`\"{} with \mbox{\hyperlink{class_q_custom_plot_ae896140beff19424e9e9e02d6e331104}{Q\+Custom\+Plot\+::move\+Layer}}.

The rendering order within one layer is simply by order of creation or insertion. The item created last (or added last to the layer), is drawn on top of all other objects on that layer.

When a layer is deleted, the objects on it are not deleted with it, but fall on the layer below the deleted layer, see \mbox{\hyperlink{class_q_custom_plot_a40f75e342c5eaab6a86066a42a0e2a94}{Q\+Custom\+Plot\+::remove\+Layer}}. 

\subsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{class_q_c_p_layer_a5d0657fc86d624e5efbe930ef21af718}\label{class_q_c_p_layer_a5d0657fc86d624e5efbe930ef21af718}} 
\index{Q\+C\+P\+Layer@{Q\+C\+P\+Layer}!Q\+C\+P\+Layer@{Q\+C\+P\+Layer}}
\index{Q\+C\+P\+Layer@{Q\+C\+P\+Layer}!Q\+C\+P\+Layer@{Q\+C\+P\+Layer}}
\subsubsection{\texorpdfstring{Q\+C\+P\+Layer()}{QCPLayer()}}
{\footnotesize\ttfamily Q\+C\+P\+Layer\+::\+Q\+C\+P\+Layer (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}} $\ast$}]{parent\+Plot,  }\item[{const Q\+String \&}]{layer\+Name }\end{DoxyParamCaption})}

Creates a new \mbox{\hyperlink{class_q_c_p_layer}{Q\+C\+P\+Layer}} instance.

Normally you shouldn\textquotesingle{}t directly instantiate layers, use \mbox{\hyperlink{class_q_custom_plot_ad5255393df078448bb6ac83fa5db5f52}{Q\+Custom\+Plot\+::add\+Layer}} instead.

\begin{DoxyWarning}{Warning}
It is not checked that {\itshape layer\+Name} is actually a unique layer name in {\itshape parent\+Plot}. This check is only performed by \mbox{\hyperlink{class_q_custom_plot_ad5255393df078448bb6ac83fa5db5f52}{Q\+Custom\+Plot\+::add\+Layer}}. 
\end{DoxyWarning}


\subsection{Member Function Documentation}
\mbox{\Hypertarget{class_q_c_p_layer_a183b90941fc78f0b136edd77c5fb6966}\label{class_q_c_p_layer_a183b90941fc78f0b136edd77c5fb6966}} 
\index{Q\+C\+P\+Layer@{Q\+C\+P\+Layer}!children@{children}}
\index{children@{children}!Q\+C\+P\+Layer@{Q\+C\+P\+Layer}}
\subsubsection{\texorpdfstring{children()}{children()}}
{\footnotesize\ttfamily Q\+List$<$ \mbox{\hyperlink{class_q_c_p_layerable}{Q\+C\+P\+Layerable}} $\ast$ $>$ Q\+C\+P\+Layer\+::children (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}

Returns a list of all layerables on this layer. The order corresponds to the rendering order\+: layerables with higher indices are drawn above layerables with lower indices. \mbox{\Hypertarget{class_q_c_p_layer_ad322905c4700dcc7ceba63e011c730d2}\label{class_q_c_p_layer_ad322905c4700dcc7ceba63e011c730d2}} 
\index{Q\+C\+P\+Layer@{Q\+C\+P\+Layer}!index@{index}}
\index{index@{index}!Q\+C\+P\+Layer@{Q\+C\+P\+Layer}}
\subsubsection{\texorpdfstring{index()}{index()}}
{\footnotesize\ttfamily int Q\+C\+P\+Layer\+::index (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}

Returns the index this layer has in the \mbox{\hyperlink{class_q_custom_plot}{Q\+Custom\+Plot}}. The index is the integer number by which this layer can be accessed via \mbox{\hyperlink{class_q_custom_plot_a0a96244e7773b242ef23c32b7bdfb159}{Q\+Custom\+Plot\+::layer}}.

Layers with higher indices will be drawn above layers with lower indices. \mbox{\Hypertarget{class_q_c_p_layer_ac07671f74edf6884b51a82afb2c19516}\label{class_q_c_p_layer_ac07671f74edf6884b51a82afb2c19516}} 
\index{Q\+C\+P\+Layer@{Q\+C\+P\+Layer}!set\+Visible@{set\+Visible}}
\index{set\+Visible@{set\+Visible}!Q\+C\+P\+Layer@{Q\+C\+P\+Layer}}
\subsubsection{\texorpdfstring{set\+Visible()}{setVisible()}}
{\footnotesize\ttfamily void Q\+C\+P\+Layer\+::set\+Visible (\begin{DoxyParamCaption}\item[{bool}]{visible }\end{DoxyParamCaption})}

Sets whether this layer is visible or not. If {\itshape visible} is set to false, all layerables on this layer will be invisible.

This function doesn\textquotesingle{}t change the visibility property of the layerables (\mbox{\hyperlink{class_q_c_p_layerable_a3bed99ddc396b48ce3ebfdc0418744f8}{Q\+C\+P\+Layerable\+::set\+Visible}}), but the \mbox{\hyperlink{class_q_c_p_layerable_ab054e88f15d485defcb95e7376f119e7}{Q\+C\+P\+Layerable\+::real\+Visibility}} of each layerable takes the visibility of the parent layer into account. 

The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
R\+:/\+Develop/a0-\/develop/\+Lib\+Q\+Qt/src/charts/qcustomplot/\mbox{\hyperlink{qcustomplot_8h}{qcustomplot.\+h}}\item 
R\+:/\+Develop/a0-\/develop/\+Lib\+Q\+Qt/src/charts/qcustomplot/\mbox{\hyperlink{qcustomplot_8cpp}{qcustomplot.\+cpp}}\end{DoxyCompactItemize}
